package com.hyh.gumballmachine;

import com.hyh.state.HasQuaterState;
import com.hyh.state.NoQuarterState;
import com.hyh.state.SoldOutState;
import com.hyh.state.SoldState;
import com.hyh.state.State;
import com.hyh.state.WinnerState;

public class GumballMachine  {

	public State state;
	public State noQuarterState;
	public State soldState;
	public State soldOutState;
	public State hasQuarterState;
	public State winnerState;
	private int count;
	
	public GumballMachine(int count) {
		this.count = count;
		noQuarterState=new NoQuarterState(this);
		soldState=new SoldState(this);
		soldOutState=new SoldOutState(this);
		hasQuarterState=new HasQuaterState(this);
		winnerState = new WinnerState(this);
		state = noQuarterState;
	}

	public State getState() {
		return state;
	}

	public void setState(State state) {
		this.state = state;
	}

	public int getCount() {
		return count;
	}

	public void setCount(int count) {
		this.count = count;
	}
	
	public void insertQuarter(){
		state.insertQuarter();
	}
	
	public void ejectQuarter(){
		state.ejectQuarter();
	}
	
	public void turnCrank(){
		state.turnCrank();
	}
	
	public void dispense(){
		state.dispense();
	}
	
}
